//
//  BaseViewController.m
//  DemoApp
//
//  Created by Mac020 on 15/5/8.
//  Copyright (c) 2015年 sxq09876. All rights reserved.
//

#import "BaseViewController.h"

@interface BaseViewController (){
    BOOL isShowStatusBar;
}

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    isShowStatusBar = YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

/**
 *  更新页面，根据isShow决定是否显示statusBar
 *
 *  @param isShow 是否显示statusBar
 */
- (void)updateStatusBarWithShowFlag:(BOOL)isShow{
    isShowStatusBar = isShow;
    if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
        // iOS 7
        [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
    } else {
        // iOS 6
        [[UIApplication sharedApplication] setStatusBarHidden:!isShowStatusBar withAnimation:UIStatusBarAnimationSlide];
    }
}

- (BOOL)prefersStatusBarHidden{
    return !isShowStatusBar; //返回NO表示要显示，返回YES将hiden
}
@end
